/**
 * ActionAddBaseStation
 *
 * @created Mar 1, 2007
 * @author jprieur
 *
 */
package mygui;

import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import kernel.*;
import objects.*;

public class ActionAddNetwork extends AbstractAction
{

    MonIHM _gui;

    public ActionAddNetwork(MonIHM gui)
    {
	_gui = gui;
	putValue(AbstractAction.NAME, "Add a sensor network");
	putValue(AbstractAction.SHORT_DESCRIPTION, "Add a sensor network");
	putValue(AbstractAction.ACCELERATOR_KEY,
		 KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK));
	putValue(AbstractAction.SMALL_ICON,
		 UIM.createImageIcon("images/wireless.png","Add a sensor network"));
    }

    public void actionPerformed(ActionEvent e)
    {
	JToggleButton button = (JToggleButton)e.getSource();
	if(!button.isSelected()){
	    _gui.getAffichage().setMode(DisplayPanel.Mode.ARROW);
	}else{
	    _gui._sink.setSelected(false);
	    /*Object[] choices = ModelManager.getModelManager().getModels(ModelManager.SENSOR_NETWORK).keySet().toArray();
	    String s = (String)JOptionPane.showInputDialog(_gui,
							   "Choose the model to use",
							   "Sensor network model",
							   JOptionPane.PLAIN_MESSAGE,
							   UIM.createImageIcon("images/model.png",""), 
							   choices,
							   "default");
	    if ((s != null) && (s.length() > 0)){
		ModelManager.getModelManager().setCurrentModel(s,ModelManager.SENSOR_NETWORK);
	    }else{
		ModelManager.getModelManager().setCurrentModel("default",ModelManager.SENSOR_NETWORK);
	    }*/
	    _gui.getAffichage().setMode(DisplayPanel.Mode.SENSOR_ADD);
	}
    }

}